<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>

//var docCreateDate ='<c:out value="${dtDocument.docCreateDate}"/>';

var limitObj=new Object();//用于保存word正文控制大小信息对象  limitObj.num限制大小  limitObj.str限制大小对应提示文字
limitObj.num=10485760;//默认10M
limitObj.str="10M";//默认10M

$(function(){
	//因为tab页签里面使用的是iframe，所以加载完成后需要调整iframe高度。
	//ps:如果调用此方法，jsp页面中<!DOCTYPE>标签必须写在最顶端，不然在垃圾ie浏览器中获取不到body高度
	$(window.self.frameElement).height($("body").outerHeight(true));
	//$("#docCreateDate").val(dataFormatStr(new Date(docCreateDate),"yyyy-MM-dd"));
	//$("#docCreateDate").textbox("setValue", dataFormatStr(new Date(docCreateDate),"yyyy-MM-dd"));
});

//下载附件
function fileUploadDownloadDocAttach(control,attachId,suffixName,attachName){
	var newFlag="";
	if("newFile"==$(control).parent("li").attr("class")){
		newFlag="1";
	}else{
		newFlag="0";
	}
	window.location.href =_synergyContext+"/basic/synAttach/downLoadFile?attachId=" + attachId + "&attachName="+encodeURIComponent(encodeURIComponent(attachName))+"&suffixName="+suffixName+"&newFlag="+newFlag;
}

//查看正文公文
function showDocDocument(){
	var docId = $("#docUuid").val();
	//下载公文到app下
	$.ajax({//ajax保存表单基本信息
	   type: "POST",
	   url: "<c:url value='/receive/querySynOfficial' />",
	   data:"docId="+docId,
	   dataType: "json",
	   async:false,
	   success: function(msg){
	     if(msg.state=="200"){
	    	 var vHeight = window.screen.height -73 ;
//    		 var wordUrl =_synergyContext+"/basic/office/editOffice?docId=" + docId + "&fileReadOnly=true&notkHeigth="+vHeight;
	    	 var wordUrl =_synergyContext+"/basic/office/editOfficeNoDocId" + "?docId=" +docId + "&officialId=" +msg.officialId + "&formId=-1&docType=done&fileReadOnly=true&notkHeigth="+vHeight+"&limitNum="+limitObj.num+"&limitStr="+limitObj.str;
//    		 var winFeatures = "height="+vHeight+"px,width="+(window.screen.width-20)+"px,top=0,left=0,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no";
//    		 window.open(wordUrl,'_blank',winFeatures);
	    	 ntkoBrowser.openWindow(wordUrl);
	     }else{
	    	 $.messager.alert("提示","该公文没有正文");
	    	 return;
	     }
	   }
	});
}

function downloadOfficeFile(){
	var docId = $("#docUuid").val();
	//下载公文到app下
	$.ajax({//ajax保存表单基本信息
	   type: "POST",
	   url: "<c:url value='/receive/querySynOfficial' />",
	   data:"docId="+docId,
	   dataType: "json",
	   async:false,
	   success: function(msg){
	     if(msg.state=="200"){
	    	 window.location.href=_synergyContext+'/basic/office/downLoadFile?docId='+$("#docUuid").val()+ "&officialId=" +msg.officialId +"&findByid=1&officeName="+encodeURIComponent(encodeURIComponent($("#docTitle").textbox("getValue")));
	     }else{
	    	 $.messager.alert("提示","该公文没有正文");
	    	 return;
	     }
	   }
	});
	
}

function DoArticleDetails(issueId){
	//var issueId = '${docReceiveUuid}';
	var formId = '';
	var url=_synergyContext+"/basic/donePage?issueId="+issueId+"&formId="+formId; 
	var winFeatures = "height="+(window.screen.height-80)+"px,width="+(window.screen.width-20)+"px,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,status=no";
	window.open(url,'_blank',winFeatures);
}